
import Taro from "@tarojs/taro"
import { Input,View,Text, Label,Picker} from '@tarojs/components'
import { AtButton} from "taro-ui"
import { useEffect, useState } from "react"
import { getAllPositionArea,getAllPositionPositionType } from "../../api/mode";
import './index.scss'
// import RegionPicker from "../RegionPicker"

export default function ExpectPosition(props){
  const changeItem=props.changeItem
  const [currentInfo,setCurrentInfo]=useState({...props.Info})
  const [areaSelector,setAreaSelector]= useState(props.area)
  const [positionTypeSelector,setPositionTypeSelector]= useState(props.type)
  const [minselector,setMinSelector]=useState([1,2,3,4,5,6,7,8,9,10,15,20])
  const [maxselector,setMaxSelector]=useState([1,2,3,4,5,6,7,8,9,10,15,20])


  const [areaselectorCheck,setAreaSelectorCheck]=useState(props.Info.area)
  const [positionselectorCheck,setPositionSelectorCheck]=useState(props.Info.type)
  const [minselectorCheck,setMinSelectorCheck]=useState(props.Info.minSal)
  const [maxselectorCheck,setMaxSelectorCheck]=useState(props.Info.maxSal)
  





  const handleChange=(key,value)=>{
    changeItem(({//修改子类展示数据
      ...currentInfo,
      [key]:value
      }))
  }


  return (
  <View className='expectPositionCard '>
      <View className='at-row'>

                <View className='at-col  at-col-3 expectBorder'>
        <Picker mode='selector' range={areaSelector} onChange={(e)=>{handleChange('area',areaSelector[e.detail.value])}}>
                <View className='picker'>
                  {areaselectorCheck?areaselectorCheck:'地区不限'}
                </View>
          </Picker>
        </View>


        <View className='at-col at-col-3  expectBorder'>
        <Picker mode='selector' range={positionTypeSelector} onChange={(e)=>{handleChange('type',positionTypeSelector[e.detail.value])}}>
                <View className='picker'>
                  {positionselectorCheck?positionselectorCheck:'职业选择'}
                </View>
          </Picker>
        </View>
        

        <View className='at-col  expectSal'>
        <view className='at-row'>
        <view className='at-col at-col-6'>
        <Picker mode='selector' range={minselector} onChange={(e)=>{handleChange('minSal',minselector[e.detail.value])}}>
                <View className='picker'>
                  {minselectorCheck?minselectorCheck:''}
                </View>
          </Picker>
        </view>
        <View className='line'>—</View>
        <view className='at-col at-col-6'>
        <Picker mode='selector' range={maxselector} onChange={(e)=>{handleChange('maxSal',maxselector[e.detail.value])}}>
                <View className='picker'>
                  {maxselectorCheck?maxselectorCheck:''}
                </View>
          </Picker>
        </view>
        </view>


        {/* <Input 
          className='expectSalInput expectBorder' 
          name='maxSal'
          type='text'
          value={currentInfo.maxSal}
          onBlur={(e)=>{handleChange('maxSal',e.detail.value)}}
        /> */}
        {/* <Label className='line'> 千元/月</Label> */}
          </View>
      </View>
        
  </View>
    )
  
}